/*
 * DataSource.js
 * Example processing a POST result and inserting into a database
 *  
 *  
*/

var action = request.getParameter("action");

if (action == "delete") {
	var ds = data.getDataSource("AddressBookDeletion");
	ds.setParam("id", request.getParameter("id"));
	var result = ds.doQuery();
} else {
	var ds = data.getDataSource("AddressBookInsertion");
	ds.setParam("name", request.getParameter("name"));
	ds.setParam("surname", request.getParameter("surname"));
	ds.setParam("email", request.getParameter("email"));
	var result = ds.doQuery();
}

response.redirect("/AddressBook");
